<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
<link rel="stylesheet" type="text/css"
	href="../EXT4/resources/css/ext-all.css" />
<link rel="stylesheet" type="text/css"
	href="../css/style.css" />
<script type="text/javascript" src="../EXT4/ext-all.js"></script>
<script type="text/javascript" src="../script/ext-lang-zh_CN.js"></script>
<script type="text/javascript"> 
Ext.onReady(function(){
	Ext.QuickTips.init();
	
	var itemsPerPage = 20; 
	Ext.define('Class', { 
        extend: 'Ext.data.Model', 
        // fields定义字段和数据类型 
        fields: ['id', 'className', 'bishopName','assistantName','count','age'] 
    });
	
	Ext.define('Signclassvo',{
		extend: 'Ext.data.Model',
		fields: ['id','studentName','phone','w1','w2','w3','w4','w5','w6','w7','w8','w9','w10','w11','w12']
	});
    
    Ext.define('Worktime',{
    	extend: 'Ext.data.Model',
    	fields: ['id','worktime']
    });
    
    var classstore = Ext.create('Ext.data.Store', {
        model: 'Class', 
        autoLoad: true,
        pageSize: itemsPerPage,
        //使用ajax代理 
        proxy: { 
            type: 'ajax', 
            url: '../service/class1_findbyuser',
            //Reader 解码json数据 
            reader: { 
                type: 'json', 
                root: 'root', 
                total: 'total'
            }
        }
    });
    
    var signclassstore = Ext.create('Ext.data.Store', {
        model: 'Signclassvo', 
        pageSize: itemsPerPage,
        //使用ajax代理 
        proxy: { 
            type: 'ajax', 
            url: '../service/signin_all',
            //Reader 解码json数据 
            reader: { 
                type: 'json',
                root: 'signclassvos', 
                total: 'total'
            }
        }
    });
    
    var worktimestore = Ext.create('Ext.data.Store', {
    	model: 'Worktime', 
        pageSize: itemsPerPage,
        //使用ajax代理 
        proxy: { 
            type: 'ajax', 
            url: '../service/class1_findworktime',
            //Reader 解码json数据 
            reader: { 
                type: 'json', 
                root: 'worktimes'
            }
        }
    });
	
	var signpanel=Ext.create('Ext.Panel', {
	    id:'sign-panel',
	    baseCls:'x-plain',
	    renderTo:'signlist',
	    items:[{
	        xtype:'fieldset',
	        title: '查询条件',
	        collapsible: true,
	        defaultType: 'textfield',
	        layout: 'hbox',
	        items :[Ext.create('Ext.form.field.ComboBox', {
        	    displayField: 'className',
        	    store: classstore,
        	    fieldLabel:'选择班级',
        	    valueField: 'id',
        	    labelWidth:60,
                width:200,
                margin:'0 10 0 0',
        	    id: 'searchclass',
                allowBlank: false,
        	    listeners: {
        	    	select: function(comb, records) {
        	    		Ext.each(records, function(record) {
        	    			classid = record.data.id;
        	    			worktimestore.load({
                    			params: {
                    		        id: record.data.id
                    		    },
                    		});
                		    Ext.getCmp('searchworktime').setDisabled(false);
                		    Ext.getCmp('searchworktime').setValue();
                		    signclassstore.removeAll();
        	    		});
        	    	}
        	    }
        	}),Ext.create('Ext.form.field.ComboBox', {
        	    displayField: 'worktime',
        	    store: worktimestore,
        	    fieldLabel:'上课时间',
        	    valueField: 'id',
                queryMode: 'local',
	        	disabled: true,
                labelWidth:60,
                width:200,
                margin:'0 10 0 0',
        	    id: 'searchworktime',
                allowBlank: false,
        	    listeners: {
        	    	select: function(comb, records) {
        	    		Ext.each(records, function(record) {
        	    			classid = record.data.id;
        	    			signclassstore.load({
        	    				params: {
        	    					searchclass: Ext.getCmp('searchclass').getValue(),
        	    					worktime: record.data.id
        	    				}
        	    			});
        	    		});
        	    	}
        	    }
        	})]
	    },Ext.create('Ext.grid.Panel', {
	    	 store: signclassstore,
	    	 columns: [ 
						{ 
						    text: '学生姓名', width: 100, sortable: true, dataIndex: 'studentName', editor: 'textfield'
						},{ 
	    	                text: '联系方式', width: 100, dataIndex: 'phone', editor: 'textfield'
	    	            },{ 
	    	                text: 'W1', width: 60, dataIndex: 'w1', editor: 'textfield' 
	    	            },{ 
	    	                text: 'W2', width: 60, dataIndex: 'w2', editor: 'textfield' 
	    	            },{ 
	    	                text: 'W3', width: 60, dataIndex: 'w3', editor: 'textfield' 
	    	            },{ 
	    	                text: 'W4', width: 60, dataIndex: 'w4', editor: 'textfield' 
	    	            },{ 
	    	                text: 'W5', width: 60, dataIndex: 'w5', editor: 'textfield' 
	    	            },{ 
	    	                text: 'W6', width: 60, dataIndex: 'w6', editor: 'textfield' 
	    	            },{ 
	    	                text: 'W7', width: 60, dataIndex: 'w7', editor: 'textfield' 
	    	            },{ 
	    	                text: 'W8', width: 60, dataIndex: 'w8', editor: 'textfield' 
	    	            },{ 
	    	                text: 'W9', width: 60, dataIndex: 'w9', editor: 'textfield' 
	    	            },{ 
	    	                text: 'W10', width: 60, dataIndex: 'w10', editor: 'textfield' 
	    	            },{ 
	    	                text: 'W11', width: 60, dataIndex: 'w11', editor: 'textfield' 
	    	            },{ 
	    	                text: 'W12', width: 60, dataIndex: 'w12', editor: 'textfield' 
	    	            }]
	    })]
	});
	
	window.onresize = function(){
		setTimeout(function(){signpanel.setWidth(Ext.getDom("signlist").width);},100);
	};
});
</script>
</head>
<body>
	<div id="signlist"></div>
</body>
</html>